import { ServerServices } from "./index";

const services = new ServerServices();
const routes = Object.keys(ServerServices.prototype).map(methodName => {
    return {
        url: `/api/${methodName}`,
        handler: (req, res) => {
            Promise.resolve(services[methodName](req)).then(data => {
                res.json(data);
            })
        }
    }
});

export default routes;